import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

import static java.lang.Thread.sleep;

public class Test01 {
    public static void main(String[] args) throws InterruptedException {
        WebDriver webDriver=new ChromeDriver();
        webDriver.get("https://www.baidu.com/");
        //获取title
        String s=webDriver.getTitle();
        System.out.println(s);
        //获取url
        String url=webDriver.getCurrentUrl();
        System.out.println(url);
        //浏览器最大化
        webDriver.manage().window().maximize();
        sleep(3000);
        //浏览器前进后退
        webDriver.findElement(By.cssSelector("#kw")).sendKeys("海边");
        webDriver.findElement(By.cssSelector("#su")).click();
        sleep(3000);
        //后退
        webDriver.navigate().back();
        sleep(3000);
        //前进
        webDriver.navigate().forward();
        sleep(3000);
        String cur=webDriver.getCurrentUrl();
        if(cur.equals(url)){
            System.out.println("测试不通过");
        }else {
            System.out.println("测试通过");
        }

        webDriver.close();



    }
}
